<?php


require "database.php";

$__user___=file_get_contents("user.json");
$__user___=json_decode($__user___,1);
$username=$_POST["username"];
$password=$_POST["password"];
$p=0;
for ($i = 0; $i < count($__user___); $i++) {
    if($__user___[$i]["username"]==$username){
        $__user___[$i]["password"]=$password;
        $p++;
        break;
    }
}
$__user___=json_encode($__user___,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE);
file_put_contents("user.json",$__user___);
if($p==0){
    return json([
        "code"=>404,
        "msg"=>"fuiled"    
    ]);
}elseif($p==1){
    return json([
        "code"=>200,
        "msg"=>"success"    
    ]);
}else{
    return json([
        "code"=>500,
        "msg"=>"system error"    
    ]);
}







